// cd /projects/data_commons/cw_code/
// qstata cw_ind_fk_1_raw.do &

global dir_proj = "/projects/data_commons/"
global dir_cw = "${dir_proj}/cw/"
global dir_lbd = "${dir_proj}/lbd/"

di "Started at $S_DATE $S_TIME"

//==============================================================================

use "${dir_lbd}/lbd_raw_sum_fk.dta", clear

collapse (min) year_min=year, by(fk_naics)

merge 1:1 fk_naics using ${dir_cw}/cw_ind_fk, keep(match master)
list fk_naics ch_ind if _merge != 3
drop _merge

save ${dir_cw}/cw_ind_fk_raw, replace

replace year_min = . if year_min <= 2013
export delimited ${dir_cw}/cw_ind_fk_raw.csv, replace

di "Ended at $S_DATE $S_TIME"
// End of do file
